package com.ruoyi.dormitory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dormitory.mapper.TbBuildingMapper;
import com.ruoyi.dormitory.domain.TbBuilding;
import com.ruoyi.dormitory.service.ITbBuildingService;

/**
 * 类别Service业务层处理
 *
 * @author hongyi
 * @date 2023-12-28
 */
@Service
public class TbBuildingServiceImpl implements ITbBuildingService
{
    @Autowired
    private TbBuildingMapper tbBuildingMapper;

    /**
     * 查询类别
     *
     * @param id 类别主键
     * @return 类别
     */
    @Override
    public TbBuilding selectTbBuildingById(String id)
    {
        return tbBuildingMapper.selectTbBuildingById(id);
    }

    /**
     * 查询类别列表
     *
     * @param tbBuilding 类别
     * @return 类别
     */
    @Override
    public List<TbBuilding> selectTbBuildingList(TbBuilding tbBuilding)
    {
        return tbBuildingMapper.selectTbBuildingList(tbBuilding);
    }

    /**
     * 新增类别
     *
     * @param tbBuilding 类别
     * @return 结果
     */
    @Override
    public int insertTbBuilding(TbBuilding tbBuilding)
    {
//        tbBuilding.setCreateTime(DateUtils.getNowDate());
        tbBuilding.setId(UUID.randomUUID().toString().replaceAll("-",""));
        return tbBuildingMapper.insertTbBuilding(tbBuilding);
    }

    /**
     * 修改类别
     *
     * @param tbBuilding 类别
     * @return 结果
     */
    @Override
    public int updateTbBuilding(TbBuilding tbBuilding)
    {
        tbBuilding.setUpdateTime(DateUtils.getNowDate());
        return tbBuildingMapper.updateTbBuilding(tbBuilding);
    }

    /**
     * 批量删除类别
     *
     * @param ids 需要删除的类别主键
     * @return 结果
     */
    @Override
    public int deleteTbBuildingByIds(String[] ids)
    {
        return tbBuildingMapper.deleteTbBuildingByIds(ids);
    }

    /**
     * 删除类别信息
     *
     * @param id 类别主键
     * @return 结果
     */
    @Override
    public int deleteTbBuildingById(String id)
    {
        return tbBuildingMapper.deleteTbBuildingById(id);
    }
}
